// 导入用户集合
const { Message } = require('../../../model/message');
const { decodeToken } = require('../../../middleGuard/jwt')

module.exports = async (req, res) => {
  const { fromUser } = req.body
  const myUserId = decodeToken(req.headers.authorization).userId
  const list = await Message.updateMany({ fromUser, toUser: myUserId }, {isRead: true})
  res.json({
      message: '更新成功'
  })
}